<!-- 节目信息 -->
<template>
  <div class="box-container bg-white rounded-md flex flex-col">
    <header class="px-4 relative h-[44px] flex items-center gap-4">
      <div v-for="item in props.alarmData" :key="item.alarmGroupName" class="h-full">
        <div
          class="title relative h-full flex items-center justify-center px-2 cursor-pointer"
          :style="{
            color: activeKey === item.alarmGroupName ? '#4974F7' : '#393940',
            'border-bottom': activeKey === item.alarmGroupName ? '3px solid #4974F7' : ''
          }"
          @click="changeMenu(item)"
        >
          {{ item.label }}
        </div>
      </div>
    </header>
    <div style="background-color: rgba(160, 175, 196, 0.2); width: 100%; height: 1px"></div>
    <footer class="flex-1 w-full px-4 pt-3 pb-2">
      <!-- <component :is="activeCom"></component> -->
    </footer>
  </div>
</template>

<script setup>
import { ref, toRefs } from 'vue'
const props = defineProps({
  alarmData: {
    type: Array,
    default: () => []
  }
})

// const { alarmData } = toRefs(props)

const activeKey = ref()
// if (alarmData.value.length) {
//   activeKey.value = alarmData.value[0].alarmGroupName
// }
const changeMenu = (item) => {
  if (activeKey.value === item.alarmGroupName) {
    return
  }
  activeKey.value = item.alarmGroupName
}
</script>

<style lang="less" scoped>
.box-container {
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, #ffffff, #e8f0fa);
  border: 1px solid #e6ebf1;
  box-shadow: 0px 2px 3px 0px rgba(184, 184, 184, 0.45);

  .title {
    font-size: 18px;
    font-family: PingFang SC;
    font-weight: 500;
  }
}
</style>
